
<?php

include_once '../Controller/loginController.php';
$lgController = new loginController();

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $action = (isset($_POST['action'])) ? $_POST['action'] : '';
    if ($action == 'LOGINPOPUP') {
        $lgController->loginPopup();
    } else if ($action == 'LOGIN') {
        $lgController->checkLogin();
    } else if ($action == 'LOGINAGENT')
        $lgController->checkLoginAgent();
    else if ($action == 'CHECKOLDPASSWORDPLAYER') {
        $result = $lgController->checkOldPasswordPlayer();
        echo json_encode($result == 1 ? TRUE : FALSE);
    } else if ($action == 'UPDATENEWPASSWORDPLAYER') {
        $result = $lgController->updateNewPasswordPlayer();
        echo json_encode($result == 1 ? TRUE : FALSE);
    } else if ($action == 'SHOWPLAYERBETHISTORY') {
        $lgController->getPlayerBetHistory();
    }
} else {
    $action = (isset($_GET['action'])) ? $_GET['action'] : '';
    if ($action == 'LOGOUT') {
        $lgController->logout();
    } else if ($action == 'LOGOUTAGENT') {
        $lgController->logoutAgent();
    }
}
?>
